home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / networking / 3174 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  12.4 KB

  1. Path: cs.uwa.edu.au!jasonb
  2. From: jasonb@cs.uwa.edu.au (Jason S Birch)
  3. Newsgroups: comp.sys.amiga.networking
  4. Subject: Re: Announce: AWeb 1.0 released!
  5. Date: 29 Mar 96 13:04:06 GMT
  6. Organization: The University of Western Australia
  7. Message-ID: <jasonb.828104646@cs.uwa.edu.au>
  8. References: <4iva78$5pa@news.xs4all.nl> <4j1f6e$984@news.uni-c.dk> <jasonb.827822336@cs.uwa.edu.au> <4j8o6r$9vj@serpens.rhein.de> <jasonb.827896888@cs.uwa.edu.au> <4jaue8$jh4@serpens.rhein.de> <jasonb.827996764@cs.uwa.edu.au> <4je3qj$kk@serpens.rhein.de> <jasonb.828076494@cs.uwa.edu.au> <4jgdfr$8f4@serpens.rhein.de>
  9. NNTP-Posting-Host: decadence.cs.uwa.oz.au
  10. X-Newsreader: NN version 6.5.0 #3 (NOV)
  11.  
  12. mlelstv@serpens.rhein.de (Michael van Elst) writes:
  13. >jasonb@cs.uwa.edu.au (Jason S Birch) writes:
  14. >>AmFTP for examples of this. As a side effect, because MUI doesn't show
  15. >>a button being depressed unless it is also about to process it, those
  16. >>applications also give an immediate response to those events.
  17.  
  18. >Sounds really useful if the button doesn't react.
  19.  
  20. Luckily it does. Because, as I said, CPU intensive stuff is at a lower
  21. priority, either because the user manually lowers the priority (would
  22. you run a raytrace at the same priority as your shell or editor? Even
  23. before Executive came along, I took advantage of AmigaOS's scheduling
  24. system to ensure user interface responsiveness even under a heavy
  25. load by adjusting priorities) or because they're running something
  26. like Executive that does the same sort of thing automatically.
  27.  
  28. >>This is
  29. >>in contrast to AWeb, which *does* show the button being depressed
  30. >>immediately, but the actual processing of the event can take a second
  31. >>or two, so it feels sluggish.
  32.  
  33. >What would you think about a keyboard where the keys are stuck until
  34. >a program reads from the keyboard ?
  35.  
  36. I'd hate it. I remember using an electric typewriter that was like
  37. that about 12 years ago, now. Very painful.
  38.  
  39. >Obviously you want to be able to press keys on the keyboard and you
  40. >accept that the characters might appear _a little later_. Same with
  41. >gadgets and mouseclicks. The problem is one of _time_. You expect
  42. >some things to happen immediately, other things are acceptable when
  43. >delays for a fraction of a second, other things are allowed to take
  44. >seconds, minutes, hours, whatever. The trick is to provide appropriate
  45. >feedback.
  46.  
  47. There's no need to construct a straw man, Michael. I've already said,
  48. right from the beginning, that the GUI should provide immediate
  49. feedback. Never claimed otherwise. I've also already said that the way
  50. to do it in MUI is for the programmer to ensure CPU intensive tasks
  51. are always offloaded onto a subprocess running at a lower priority.
  52.  
  53. Hmm... And I seem to recall that the point to which you are responding
  54. was how a particular MUI program not only visually responded
  55. immediately to a mouseclick, but processed the mouseclick as well,
  56. while a non-MUI program visually responded but didn't process it for
  57. some time. Talking about how bad not visually responding to
  58. mouseclicks is doesn't seem to follow.
  59.  
  60. >And with the gadgets running completely on the user process you cannot
  61. >provide the feedback all the time. 
  62.  
  63. Thanks to Exec's scheduler, you can *if running at a high enough
  64. priority*. Priority 0 is plenty high enough if CPU intensive stuff is
  65. lower.
  66.  
  67. >It depends on how fast your machine
  68. >is, how much work your program has to do and wether other _user
  69. >processes_ are using up CPU time.
  70.  
  71. *And*, most importantly, their priority.
  72.  
  73. >It is much simpler to provide timely feedback if the user interface
  74. >runs at a higher priority. 
  75.  
  76. Bingo.
  77.  
  78. >And that's what the Amiga and Intuition
  79. >does, it has a user interface process run by input.device.
  80.  
  81. That's right, and that's wonderful. Unfortunately there are drawbacks:
  82.  
  83. >Obviously this has a disadvantage since many user interfaces also
  84. >perform low priority actions. So you need at least part of the interface
  85. >running on the high priority process and offload part of the interface
  86. >to a low priority task. This can be a new task (but which possibly
  87. >needs complex locking of data structures) or the user program (but which
  88. >might interfere with long term calculations).
  89.  
  90. Another one is wanting to have a uniform notification scheme which can
  91. work uniformly on any attribute of any object. Running your GUI event
  92. handling code on two separate tasks, one at pri 20 and one at the usual
  93. pri, would make this very messy. So MUI does it all on the usual
  94. priority task's context, which makes MUI simpler but means the
  95. programmer has to be aware of the issues of GUI responsiveness and
  96. ensure his event handling loop is always ready and waiting. It also
  97. means it's more uniform -- as has been noted before, not even GadTools
  98. does *all* it's GUI response at pri 20 -- some gadgets are refreshed by
  99. input.device, some aren't. You even have some things -- like the
  100. AmigaGuide datatype laying out AmigaGuide documents -- running at pri
  101. 20 when they really shouldn't be.
  102.  
  103. >>Obviously, because of the way MUI works, a program written in exactly
  104. >>the same way AWeb has been, but using MUI instead, would be even
  105. >>worse, because the buttons themselves wouldn't depress for a second or
  106. >>two. The point is (good) programmers don't program in MUI in the same
  107. >>way. They use a subtask or put the application to sleep.
  108.  
  109. >And they have to raise the priority of the user interface to be safe
  110. >against other user processes. 
  111.  
  112. Or, to put it another way -- you can lower the priority of tasks not
  113. directly communicating with the user. That's why you manually set the
  114. priority of your raytracer ("doing a raytrace in the background", as
  115. they say) below that of your editor. The total time to perform the
  116. raytrace isn't affected, but the user interface responsiveness *is*. 
  117. Executive simply tries to do this automatically. That's all.
  118.  
  119. >Usuability of the user interfaces and
  120. >other real-time tasks now becomes the policy of individual programs
  121. >and their programmers.
  122.  
  123. Only if they don't separate event handling from CPU intensive code
  124. which disallows the user from running one of them at a lower priority.
  125. This is true regardless of MUI or Executive. When Real3D's raytracing,
  126. for example, I don't lower the *whole* program to -20 -- just the
  127. DrawTasks. The program itself I keep at a normal priority so it stays
  128. responsive. All that's required of the programmer is to provide that
  129. separation.
  130.  
  131. BTW, both Workbench and AmiWin run themselves at priorities >0. The
  132. notion is not new.
  133.  
  134. >>*rendering* to be done concurrently, just as long as they're done
  135. >>concurrently at a lower priority than the main application's event
  136. >>handling loop.
  137.  
  138. >With the standard Exec scheduler you can even allow it to run on
  139. >the same priority. 
  140.  
  141. But what do you gain from doing so? Sure, maximum latency may well be
  142. short if you don't have too many processes, but it would be nonexistent
  143. if those processes were just *1* below the event handling loop, and not
  144. dependent on how busy the machine is. The beauty of Exec's scheduler
  145. (which Executive doesn't actually change, BTW) is that higher priority
  146. tasks will *always* get the CPU when they want. Run the event handling
  147. loop of the task that the user is currently sending events to at a
  148. priority of just 1 above (that's 1 higher than the others, not *at*
  149. priority 1) other user processes in the system, and it will always be
  150. perfectly responsive regardless of how busy the machine is.
  151.  
  152. >>would then be simply waiting for user input -- would quite naturally
  153. >>get a higher priority.
  154.  
  155. >But the event handling is already done at a higher priority. What you
  156.  
  157. Not for all GadTools gadgets.
  158.  
  159. >want to do is to do some dummy event handling at priority 20 and then
  160. >the real event handling at priority 0 (where it has to compete with
  161. >other user tasks because not everyone wants to adapt his programs to
  162. >not interfere with MUI).
  163.  
  164. Of course they don't. I'm not talking about changing AWeb so it won't
  165. "interfere" with MUI -- I'm talking about making AWeb *itself* more
  166. responsive, just like IBrowse -- a *MUI* app -- is. These comments
  167. about AWeb would still be valid even if MUI never existed -- it just
  168. so happened that a convenient example of what I was talking about was
  169. a MUI program, and the fact that is *was* MUI made the point even more
  170. significant given the author's comments about MUI programs in his
  171. docs.
  172.  
  173. In case it isn't obvious -- in order for a MUI program to remain
  174. responsive, all that's required is that no CPU intensive tasks be
  175. competing with it for the CPU at the same priority. For GadTools, the
  176. priority to worry about is (for most gadgets) priority 20, so it's
  177. rarely a problem. For MUI on a typical system, it's 0 -- which means,
  178. *for best results*, the user (or something like Executive) should ensure
  179. that any CPU intensive tasks run at less than that. Before MUI came
  180. along, Amiga users were always boasting about running raytracers at a
  181. low priority and how "it didn't slow down their text editor one bit",
  182. so the concept is not new. With Executive it can all be done
  183. automatically.
  184.  
  185. >>Executive dynamically adjusts the priorities every second so that, over
  186. >>time, several CPU-intensive tasks (originally at the same priority)
  187. >>will indeed get equal amounts of CPU time.
  188.  
  189. >That would mean that Executive always keeps the processes at the same
  190. >priority. 
  191.  
  192. Of course it doesn't. Over a long period of time they get the same
  193. amount of CPU (all else being equal), but in one second they can get
  194. vastly different amounts. Three CPU intensive processes will have
  195. their priorities raised, in turn, so that every three seconds one will
  196. get one seconds' worth of CPU. This is exactly the same as the Exec
  197. scheduler, except Exec's dealing with much smaller quantums and makes no
  198. effort to guess a suitable ratio of CPU between processors other than
  199. blindly obeying the priority settings. In three seconds, each will still 
  200. get one seconds' worth of CPU, but they would've got it in bursts of
  201. about 0.05 seconds at a time.
  202.  
  203. >Obviously it doesn't do this and the timeslice of 1 second
  204. >is probably too long.
  205.  
  206. Yes, I'd prefer a shorter timeslice. OTOH, shorter timeslices mean
  207. increased overhead, and it also becomes more difficult to work out
  208. just which tasks really are CPU intensive at all.
  209.  
  210. >>Non-CPU intensive tasks
  211. >>are automatically raised in priority, because they are not using as
  212. >>much CPU.
  213.  
  214. >And how would you handle processes that need a lot of CPU and are
  215. >scheduled a lot ?
  216.  
  217. I would make an entry for them in Executive's preferences.
  218.  
  219. >>All it would take would be for the main event-handling task of AWeb
  220. >>not to do any heavy processing (it currently appears to do page
  221. >>layouts).
  222.  
  223. >So we now have to write our programs to make MUI happy and have
  224. >to write programs to make Executive happy. Isn't this the wrong way.
  225.  
  226. Must be a surplus of straw in Germany this year. ;-)
  227.  
  228. As I said, nothing I've said has anything to do with "making MUI
  229. happy". MUI came into it because (a) the example programs which did it
  230. the way I wanted happened to use MUI, and (b) MUI application
  231. responsiveness was derided by the author in his docs, which I found
  232. particularly ironic.
  233.  
  234. As for making Executive happy -- well, I can make an entry in
  235. Executive for AWeb to "fix" the priorities, no problem. Simply
  236. offloading *all* CPU intensive stuff onto a subtask would make that
  237. unnecessary, however, and certainly doesn't hurt those *not* using
  238. Executive -- in fact, even they might appreciate it once you got half
  239. a dozen images decoding simultaneously and you wanted to follow a link
  240. in a half-layed-out page.
  241.  
  242. Given he's already spawned off network transferring and image decoding
  243. onto subtasks, is it really such a terrible thing to want page layout
  244. there as well?
  245.  
  246. >>big page is being layed out, and it's taking up an awful lot of CPU.
  247.  
  248. >awful ? because it doesn't keep Executive happy ?
  249.  
  250. Hmm... Perhaps you read more into the word than I intended. "An awful
  251. lot", in this context, simply means "lots". No more, no less. It's a
  252. figure of speech.
  253.  
  254. >>>I can't see that MUI feels responsive when I click on a gadget and
  255. >>>do not get any feedback.
  256.  
  257. >>You've experienced this with one of the three apps I mentioned above?
  258.  
  259. >Yes. And no, I do not run Executive anymore.
  260.  
  261. Well, even before I ran Executive, I always set priorities manually to
  262. ensure processes like my editor ran higher than processes like Real3D.
  263.  
  264. >Regards,
  265. >                                Michael van Elst
  266. >Internet: mlelstv@serpens.rhein.de
  267.  
  268. -- 
  269. Jason S Birch                        ,-_|\ email: jasonb@cs.uwa.edu.au
  270. Department of Computer Science      /     \ Tel (work): +61 9 380 1840
  271. The University of Western Australia *_.-._/ Fax (work): +61 9 380 1089
  272. Nedlands  W. Australia  6907             v  Tel (home): +61 9 386 8630
  273.